package com.nuaa.yupicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nuaa.yupicturebackend.model.dto.space.SpaceAddRequest;
import com.nuaa.yupicturebackend.model.dto.space.SpaceLevel;
import com.nuaa.yupicturebackend.model.dto.space.SpaceQueryRequest;
import com.nuaa.yupicturebackend.model.entity.Space;
import com.nuaa.yupicturebackend.model.entity.Space;
import com.nuaa.yupicturebackend.model.entity.User;
import com.nuaa.yupicturebackend.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;


/**
 * @author 11352
 * @description 针对表【space(空间)】的数据库操作Service
 * @createDate 2024-12-24 14:13:55
 */
public interface SpaceService extends IService<Space> {
    /**
     * 创建空间
     *
     * @param spaceAddRequest 请求
     * @param loginUser       已登录用户
     * @return 创建空间的id
     */
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 查询空间列表
     *
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     * 获取空间的封装类
     *
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 获取到封装类
     *
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

    /**
     * 校验空间
     *
     * @param space
     */
    void validSpace(Space space, boolean add);

    /**
     * 根据空间等级分配大小
     *
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 获取空间等级列表
     *
     * @return 空间等级
     */
    List<SpaceLevel> listSpaceLevel();

}
